var flag = true;
onmessage =function (evt){
  flag = evt.data;
  if(evt.data){
    timedCount();
  }
}
function timedCount()
{
  if(flag){
    postMessage(0);
    setTimeout("timedCount()",500);
  }
}
